#include"include.h"

void printDict(dict_t *d);

int main()
{
   dict_t *d = newDict((int(*)(const void *, const void *))strcmp);
   printf("Empty dict is empty: %s. Size is: %d\n", dictIsEmpty(d) ? "true" : "false", dictSize(d));
   dictClear(d);
   printf("Cleared dict is empty: %s. Size is: %d\n\n", dictIsEmpty(d) ? "true" : "false", dictSize(d));
   
   printf("Putting in [\"apple\" : \"red\"] and [\"appledict\" : [\"apple\" : \"red\"]]\n\n");

   dictPut(d, "apple", "red");
   dict_t *nd = newDict((int(*)(const void *, const void *))strcmp);
   dictPut(nd, "apple", "red");
   dictPut(nd, "appledict", d);
   
   printf("Dict contains key apple: %s\n", dictContainsKey(nd, "apple") ? "true" : "False");
   printf("Dict contains key appledict: %s\n", dictContainsKey(nd, "appledict") ? "true" : "False");
   //printf("Dict contains value red: %s\n", dictContainsValue(nd, "red") ? "True" : "False");
   printf("Dict size is %d\n\n", dictSize(nd));

   dictRemove(nd, "appledict");
   printf("Removed appledict\n\n");

   printf("Dict contains key apple: %s\n", dictContainsKey(nd, "apple") ? "true" : "False");
   printf("Dict contains key appledict: %s\n", dictContainsKey(nd, "appledict") ? "true" : "False");
   //printf("Dict contains value red: %s\n", dictContainsValue(nd, "red") ? "True" : "False");
   printf("Value of apple: %s\n", (char *)dictGet(nd, "apple"));
   printf("Dict size is %d\n\n", dictSize(nd));


   dictClear(nd);
   printf("Cleared dict is empty: %s. Size is: %d\n", dictIsEmpty(nd) ? "true" : "false", dictSize(nd));
   return 0;
}
